from tests.pytests.helpers.codegen_helpers import compile_chunk, assert_code_contains


def test_if_elif_else():
    def classify(x: int) -> int:
        if x < 0:
            return -1
        elif x == 0:
            return 0
        else:
            return 1

    block = compile_chunk(classify)
    assert_code_contains(
        block,
        """
        int classify(int x) {
            if (x < 0) {
                return -1;
            } else if (x == 0) {
                return 0;
            } else {
                return 1;
            }
        }
        """,
    )
